home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
PROGNG_C
/
M2COMP.LZH
/
SYSTEM.DEF
< prev
next >
Wrap
Text File
|
1987-06-29
|
4KB
|
145 lines
DEFINITION MODULE System;
(* (C) Copyright 1987 Fitted Software Tools. All rights reserved. *)
(*
This module contains definitions that are SYSTEM DEPENDENT.
This version is for the IBM PC running DOS >= 2.0.
*)
FROM SYSTEM IMPORT WORD, ADDRESS;
VAR
(* FOR EXCLUSIVE USE OF M2LINK. DO NOT TOUCH! *)
Main, ProfStart, ProfEnd :PROC;
(* START OF EXPORTED STUFF: *)
DOSVersion :CARDINAL; (* DOS version * 100 *)
PSP :CARDINAL; (* paragraph pointer to DOS program prefix *)
MemTop :CARDINAL; (* end of memory (paragraph) *)
HeapBase :CARDINAL; (* start of heap (paragraph) *)
StackSeg :CARDINAL; (* stack segment (paragraph) *)
StackSize :CARDINAL; (* initial SP value *)
HeapTop :CARDINAL; (* end of heap (paragraph) *)
(* updated by Storage *)
AX, BX, CX, DX, SI, DI :CARDINAL;
BP, DS, ES :CARDINAL;
FLAGS :BITSET;
CONST
carryFlag = 0; (* carry flag IN FLAGS *)
zeroFlag = 6; (* zero flag IN FLAGS *)
PROCEDURE GetArg( VAR arg: ARRAY OF CHAR; VAR length :CARDINAL );
(*
returns the next argument in the command line
*)
PROCEDURE GetEnv( var :ARRAY OF CHAR; VAR val :ARRAY OF CHAR );
(*
loads val with the value of the environment variable var.
val will be loaded with the null string if var is not found.
*)
PROCEDURE Trap( intno :CARDINAL );
(*
loads the 8088 registers with the contents of AX..DI
and then generates the software interrupt specified.
On return from the interrupt, the registers are saved
in AX..DI. The processor flags are stored in FLAGS.
*)
PROCEDURE XTrap( intno :CARDINAL );
(*
loads the 8088 registers with the contents of AX..ES
and then generates the software interrupt specified.
On return from the interrupt, the registers are saved
in AX..ES. The processor flags are stored in FLAGS.
*)
PROCEDURE Move( src :ADDRESS; dest :ADDRESS; size :CARDINAL );
(*
Move size bytes from src to dest.
IF FLAT(src) > FLAT(dest) THEN
move from low to high address
ELSE
move from high to low address
END
*)
PROCEDURE TermProcedure( p :PROC );
(*
installs a procedure to be executed when the program
terminates.
Up to 20 termination procedures may be installed.
*)
PROCEDURE Terminate( exitStatus :CARDINAL );
(*
terminates execution, sets the DOS errorlevel to exitStatus
*)
PROCEDURE GetVector( IntNum :CARDINAL; VAR ISR :ADDRESS );
(*
loads in ISR the value of the interrupt vector IntNum
*)
PROCEDURE SetVector( IntNum :CARDINAL; ISR :PROC );
(*
installs ISR to be executed when interrupt IntNum occurs.
the address loaded in the interrupt vector is that of the
start of the procedure ISR, skipping the compiler generated
entry code.
ISR must be compiled with stack checking disabled ($S-).
*)
PROCEDURE ResetVector( IntNum :CARDINAL; ISR :ADDRESS );
(*
loads the interrupt vector IntNum with the value in ISR
*)
TYPE
ErrorProc = PROCEDURE( CARDINAL, ADDRESS );
(*
A user error handling procedure is passed, in case of a runtime
error, the runtime error number and the address of the error
location.
For a list of current runtime error numbers, please consult the
system's documentation.
The error address can be related to an address in the MAP file
produced by DBG2MAP by adjusting the segment part thus:
a.SEG := a.SEG - (PSP + 10H);
If the user error handling procedure returns, default error
processing will take place and the program is terminated.
*)
PROCEDURE InstallRTErrorHandler( errorProc :ErrorProc );
(*
installs errorProc to be invoked if a runtime error is
detected.
Up to 10 error procedures may be installed, but only the last
one installed will be invoked in case of a runtime error.
*)
PROCEDURE UninstallRTErrorHandler;
(*
uninstalls the errorProc installed last.
*)
END System.